import { createStore } from 'vuex'

export default createStore({
  state: {
    userInfo: {
      openid: '',
      nickname: '',
      username: '',
      headimgurl: ''
    }
  },
  mutations: {
    setUser(state, user) {
      state.userInfo.openid = user.openid
      state.userInfo.nickname = user.nickname
      state.userInfo.username = user.username
      state.userInfo.headimgurl = user.headimgurl
    }
  },
  actions: {
  },
  modules: {
  }
})
